define(function() {
  return {
    get: function(name) {
      var arr, reg = new RegExp('(^| )' + name + '=([^;]*)(;|$)');
      if (arr = document.cookie.match(reg)) return unescape(arr[2]);
      else return null;
    },
    set: function(name, value, time, path) {
      time = time || 360000;
      path = path || '/';
      var exp = new Date();
      exp.setTime(exp.getTime() + time * 1000);
      document.cookie = name + '=' + escape(value) + '; expires=' + exp.toGMTString() + ';path=' + path;
    }
  };
});